# build front-end
FROM node:16-alpine AS build

# 声明工作目录
WORKDIR /frontend
# 拷贝整个web项目到当前工作目录
COPY . .

# 安装依赖
RUN npm config set registry https://registry.npmmirror.com --global
RUN npm install -g pnpm@8
RUN pnpm install
# 打包
RUN pnpm build:admin

FROM nginx:latest

COPY --from=build /frontend/apps/admin/dist/ /usr/share/nginx/html/
COPY nginx.conf /etc/nginx/conf.d/default.conf
